package me.liuyu.ymall.member.oauth.controller;

import me.liuyu.ymall.common.YmHttpResponse;
import me.liuyu.ymall.member.oauth.DO.MemberInfo;
import me.liuyu.ymall.member.oauth.service.MemberInfoService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author liuyu E-mail: liuyu2783@163.com
 * @Date 2018/6/21 16:47
 * @Descrption
 * @Modified By
 */
@RestController
@RequestMapping("member")
public class MemberController {

    private Logger logger = LoggerFactory.getLogger(MemberController.class);
    @Autowired
    private MemberInfoService memberService;

    @RequestMapping("getMemberInfo/{id}")
    public MemberInfo getMemberInfo(@PathVariable("id") Integer id){
        logger.info("查询会员，id={}", id);
        return memberService.selectById(id);
    }

    @RequestMapping("insertMember")
    public YmHttpResponse insertMember(@RequestBody MemberInfo memberInfo){
        logger.info("新增会员，{}", memberInfo);
        memberService.insert(memberInfo);
        return YmHttpResponse.success();
    }
}
